package com.nwpu.am.pojo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.nwpu.am.annotation.Role;
import com.nwpu.am.annotation.Sex;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Email;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDate;

/**
 * User
 *
 * @author Roy
 * @version 1.0
 * {@code @date} 2024/6/3
 */

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel("用户")
public class User implements Serializable {
    private Long userId;
    private String username;
    private String password;
    @Pattern(regexp = "^\\d{11}$", message = "电话号码为11位数字")
    @ApiModelProperty("电话号码为11位数字")
    private String phoneNum;
    @Email
    private String email;
    @Sex
    @ApiModelProperty("性别为0（男）或1（女）或2（未知）")
    private Short sex;
    private String address;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
    @ApiModelProperty("格式：yyyy-MM-dd")
    private LocalDate birthday;
    @Role
    @ApiModelProperty("角色为0（维修人员）或1（管理人员）")
    private Short role;
}
